import Integer from "./integer";
import DatePicker from "./datePicker";
import Picture from "./picture";
import TextEditor from "./textEditor";
import Text from "./text";

const fields: Record<string, React.FC> = {
  integer: Integer,
  datePicker: DatePicker,
  picture: Picture,
  textEditor: TextEditor,
  textInput: Text,
};
// const Hoc = (Comp: React.FC): React.FC => {
//   const fc: React.FC<any> = (props) => {
//     const { value, fieldId, onChange, ...other } = props;
//     const _onChange = useCallback(
//       (...a: any) => {
//         onChange?.({
//           id: fieldId,
//           value: a,
//         });
//       },
//       [onChange],
//     );
//     return <Comp value={value?.value} onChange={_onChange} {...other} />;
//   };
//   return fc;
// };
// Object.keys(fields).forEach((key) => {
//   fields[key] = Hoc(fields?.[key]);
// });
export default fields;
